/*
 * XML Type:  embedded-id
 * Namespace: http://java.sun.com/xml/ns/persistence/orm
 * Java type: com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EmbeddedId
 *
 * Automatically generated - do not modify.
 */
package com.googlecode.horncomb.orm.jpa.v10.xmlbeans.impl;
/**
 * An XML embedded-id(@http://java.sun.com/xml/ns/persistence/orm).
 *
 * This is a complex type.
 */
@SuppressWarnings("unchecked")
public class EmbeddedIdImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EmbeddedId
{

    /**  */
	private static final long serialVersionUID = 794270306372074208L;


	public EmbeddedIdImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }

    private static final javax.xml.namespace.QName ATTRIBUTEOVERRIDE$0 =
        new javax.xml.namespace.QName("http://java.sun.com/xml/ns/persistence/orm", "attribute-override");
    private static final javax.xml.namespace.QName NAME$2 =
        new javax.xml.namespace.QName("", "name");


    /**
     * Gets a List of "attribute-override" elements
     */
    public java.util.List<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride> getAttributeOverrideList()
    {
        final class AttributeOverrideList extends java.util.AbstractList<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride>
        {
            public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride get(int i)
                { return EmbeddedIdImpl.this.getAttributeOverrideArray(i); }

            public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride set(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride o)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride old = EmbeddedIdImpl.this.getAttributeOverrideArray(i);
                EmbeddedIdImpl.this.setAttributeOverrideArray(i, o);
                return old;
            }

            public void add(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride o)
                { EmbeddedIdImpl.this.insertNewAttributeOverride(i).set(o); }

            public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride remove(int i)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride old = EmbeddedIdImpl.this.getAttributeOverrideArray(i);
                EmbeddedIdImpl.this.removeAttributeOverride(i);
                return old;
            }

            public int size()
                { return EmbeddedIdImpl.this.sizeOfAttributeOverrideArray(); }

        }

        synchronized (monitor())
        {
            check_orphaned();
            return new AttributeOverrideList();
        }
    }

    /**
     * Gets array of all "attribute-override" elements
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride[] getAttributeOverrideArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(ATTRIBUTEOVERRIDE$0, targetList);
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride[] result = new com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }

    /**
     * Gets ith "attribute-override" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride getAttributeOverrideArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride)get_store().find_element_user(ATTRIBUTEOVERRIDE$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }

    /**
     * Returns number of "attribute-override" element
     */
    public int sizeOfAttributeOverrideArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(ATTRIBUTEOVERRIDE$0);
        }
    }

    /**
     * Sets array of all "attribute-override" element
     */
    public void setAttributeOverrideArray(com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride[] attributeOverrideArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(attributeOverrideArray, ATTRIBUTEOVERRIDE$0);
        }
    }

    /**
     * Sets ith "attribute-override" element
     */
    public void setAttributeOverrideArray(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride attributeOverride)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride)get_store().find_element_user(ATTRIBUTEOVERRIDE$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(attributeOverride);
        }
    }

    /**
     * Inserts and returns a new empty value (as xml) as the ith "attribute-override" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride insertNewAttributeOverride(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride)get_store().insert_element_user(ATTRIBUTEOVERRIDE$0, i);
            return target;
        }
    }

    /**
     * Appends and returns a new empty value (as xml) as the last "attribute-override" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride addNewAttributeOverride()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.AttributeOverride)get_store().add_element_user(ATTRIBUTEOVERRIDE$0);
            return target;
        }
    }

    /**
     * Removes the ith "attribute-override" element
     */
    public void removeAttributeOverride(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(ATTRIBUTEOVERRIDE$0, i);
        }
    }

    /**
     * Gets the "name" attribute
     */
    public java.lang.String getName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(NAME$2);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }

    /**
     * Gets (as xml) the "name" attribute
     */
    public org.apache.xmlbeans.XmlString xgetName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(NAME$2);
            return target;
        }
    }

    /**
     * Sets the "name" attribute
     */
    public void setName(java.lang.String name)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(NAME$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(NAME$2);
            }
            target.setStringValue(name);
        }
    }

    /**
     * Sets (as xml) the "name" attribute
     */
    public void xsetName(org.apache.xmlbeans.XmlString name)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(NAME$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(NAME$2);
            }
            target.set(name);
        }
    }
}
